/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import React, { useState } from 'react';
import {
  View,
  Text,
  TouchableOpacity,
  StyleSheet
} from 'react-native';
import IM from './src/pages/IM/index.tsx';
import VideoList from './src/pages/VideoList/index.tsx';
import PlayList from './src/pages/PlayList/PlayListPage.tsx';

function App(): JSX.Element {
  const onPressLearnMore = (type: string) => {
    setShowPage(type);
  };
  const [showPage, setShowPage] = useState('Home');
  const HomeScreen = () => (
    <View style={styles.outBtn}>
      <TouchableOpacity
        onPress={() => {
          onPressLearnMore('IM');
        }}
        style={styles.botton}>
        <Text style={{color:'#fff'}}>IM</Text>
      </TouchableOpacity>
      <TouchableOpacity
        onPress={() => {
          onPressLearnMore('music');
        }}
        style={styles.botton}>
        <Text style={{color:'#fff'}}>音乐</Text>
      </TouchableOpacity>
      <TouchableOpacity
        onPress={() => {
          onPressLearnMore('video');
        }}
        style={styles.botton}>
        <Text style={{color:'#fff'}}>长视频</Text>
      </TouchableOpacity>
    </View>
  );

  return (
    <>
      {showPage === 'Home' && <View style={{ height: 100 }}></View>}
      {showPage === 'IM' && <IM changePage={setShowPage}></IM>}
      {showPage === 'video' && <VideoList changePage={setShowPage}></VideoList>}
      {showPage === 'music' && <PlayList changePage={setShowPage}></PlayList>}
      {showPage === 'Home' && <HomeScreen></HomeScreen>}
    </>
  );
}
const styles = StyleSheet.create({
  outBtn: {
    flex:1,
    alignItems:'center',
    justifyContent:'flex-end',
    marginBottom:44
  },
  botton:  { 
    width:289,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#0A59F7',
    height: 40,
    marginTop: 12,
    borderRadius: 20
  }
});

export default App;
